<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
					<div style="display: none;">
					<input type="text" id="postId" name="postId" value="${post.id }"/>
					<input type="text" id="sendPorsonType" name="sendPorsonType" value="${post.sendPorsonType }"/>
					</div>
					<div class="caption">
						<span class="title">邮寄信息</span>
					</div>
					<div class="fieldBox col_50">
						<div class="label">工号/姓名</div>
						<div class="field">
							<input id="idCardNM"  name="idCardNM"  type="text"   class="ui-textbox"  ligerui="width: 160"
								value=""    />
							<span id="searchBtn" class="sq-button sq-button-round" onclick="searchBtn();">查询</span>
						</div>
						
					</div>
					<div class="fieldBox col_50">
						
					</div>
					
					<div class="fieldBox col_50">
						<div class="label">收件人（工号）</div>
						<div class="field">
							<input id="idCard"  name="idCard"  type="text"   class="ui-textbox"  ligerui="width: 160"
								value="${post.idCard }"  readonly  />
							
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">收件人（姓名）</div>
						<div class="field">
							<input id="recipient"  name="recipient"  type="text"   class="ui-textbox"  ligerui="width: 160"
								value="${post.recipient }"   readonly />
							
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">联系电话</div>
						<div class="field">
							<input id="mobile"  name="mobile"  type="text"   class="ui-textbox"  ligerui="width: 160"
								value="${post.mobile }"   validate="{mobile:true}" />
							
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">接收方式</div>
						<div class="field">
							<select id="sendType"  name="sendType"  class="ui-textbox"  ligerui="width: 160">
							<c:forEach items="${sendTypeList}" var="item">
								<option  value="${item.key}" <c:if test="${item.key==post.sendType}">selected</c:if> >${item.value}  </option>
							</c:forEach>
							</select>
							
							
						</div>
					</div>
				
					<div id="emailInfo" style="display: none;">
						<div class="fieldBox col_50">
							<div class="label">快递公司</div>
							<div class="field">
								<select id="sendCompany"  name="sendCompany"  ligerui="width: 160" >
										<option value="">请选择</option>
										<c:forEach items="${sendCompanyList}" var="item">
											<option value="${item.key}"  <c:if test="${item.key==post.sendCompany}">selected</c:if> >${item.value}</option>
										</c:forEach>
									</select>
							</div>
						</div>
						<div class="fieldBox col_50">
							<div class="label">快递单号</div>
							<div class="field">
								<input id="sendNum"  name="sendNum"  type="text"   class="ui-textbox"  ligerui="width: 160" 
									value="${post.sendNum }"    />
							</div>
						</div>
						<div class="fieldBox col_100">
							<div class="label">邮寄地址</div>
							<div class="field">
								<input id="sendAddr"  name="sendAddr"  type="text"   class="ui-textbox"  
									value="${post.sendAddr }"    />
							</div>
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">备注</div>
						<div class="field">
							 <textarea id="remark"  name="remark" rows="3" class="l-textarea" style="width:80%">${post.remark }</textarea>
						</div>
					</div>
				</div>
				
	<script type="text/javascript">
	$(function() {
				
		$("#sendType").change(function(){
			if(this.value!= "" && this.value == 0) {//邮寄
				$("#emailInfo").show();
			}else {
				$("#emailInfo").hide();
			}
		});
		
		
    });
		//查找人
		function searchBtn(){
			
			var wait_dialog = null;
			if($.trim($("#idCardNM").val()) == ""){
				$.ligerDialog.SQalert({content: "请填写工号",SQ_type: "warning",SQ_showButtons: true});
				return;
			}
			$.ajax({
				type: 'post',
				dataType: 'json',
				
				url: '<%=path%>/archive/arcMgrMain/searchBtn.do?idCardNM='+$("#idCardNM").val(),
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						$("#idCard").val(msg.data.usrNm);
						$("#recipient").val(msg.data.refRlNm);
						$("#mobile").val(msg.data.mp);
					}else{
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				},error:function (XMLHttpRequest, textStatus, errorThrown) { 
					wait_dialog.close();
					$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
				} 
			});
		}
		function checkPost(){
			if($.trim($("#idCard").val()) == ""){
				$.ligerDialog.SQalert({content: "输入工号，点击'查找收件人'，查询出收件人（工号）和收件人（姓名）",SQ_type: "warning",SQ_showButtons: true});
				return false;
			} 
		   if($.trim($("#mobile").val()) == ""){
				$.ligerDialog.SQalert({content: "请填写联系电话",SQ_type: "warning",SQ_showButtons: true});
				return  false;
			} 
		   if($.trim($("#sendType").val()) == ""){
				$.ligerDialog.SQalert({content: "请选择接收方式",SQ_type: "warning",SQ_showButtons: true});
				return  false;
			}
		  
		   if($.trim($("#sendType").val()) == 0){
			   if($.trim($("#sendCompany").val()) == ""){
					$.ligerDialog.SQalert({content: "请选择快递公司",SQ_type: "warning",SQ_showButtons: true});
					return  false;
				} 
			   if($.trim($("#sendNum").val()) == ""){
					$.ligerDialog.SQalert({content: "请输入快递单号",SQ_type: "warning",SQ_showButtons: true});
					return  false;
				}
			   if($.trim($("#sendAddr").val()) == ""){
					$.ligerDialog.SQalert({content: "请输入邮寄地址",SQ_type: "warning",SQ_showButtons: true});
					return  false;
				}
			}
		   return true;
	   
		}
	</script>
